Repository navigation
Photo Studio: review round 7 — data loss, correctness, memory and accessibility fixes - #238
Merged
Merged
Conversation
…s blend mode or position changes The layer style cache keyed layers whose JSON exceeded 200,000 characters by the length alone, so same-length edits (Normal to Screen, moving a child from x 100 to 200) kept showing the old group content and effects. Such layers are now keyed by a 53-bit digest of their JSON.
…hanges partly transparent pixels by its coverage alone It composited source-over and then put the old alpha back, so the color change was weighted by the pixel's own alpha too: a 50% black gradient over a half-transparent gray pixel made it 67 instead of 100, and soft edges took more of the gradient than the interior. It now mixes like brushes and Edit > Fill do on a locked layer.
…en is released beyond 256 MB The style cache kept each layer's rendered effects for as long as the layer existed, so removing styles from several large layers kept hundreds of megabytes of textures. Results not drawn in the last frame are now kept up to a 256 MB budget (quick off/on toggles still reuse them) and the least recently drawn are released past it.
…eview show only black and white, exactly as OK applies The GPU applied Threshold's step through a 1024-entry table, which blurs the edge across one entry: pixels whose luma lay within a quarter level of it came out gray (102, 102, 206 at level 110 gave 83 instead of 255). The compiled adjustment now carries the exact edge and the LUT pass compares against it on both WebGPU and WebGL2.
…nsparency is locked Brushes, fills and the Gradient tool already left a locked layer's coverage alone, but filters did not: a Gaussian Blur softened the edge of a locked shape and Liquify pushed pixels into its transparent areas. Destructive filters (the dialog's canvas and pane previews, OK, Last Filter) and Liquify (its workspace preview and OK) now keep each pixel's alpha and change only its color. Live Filters are unchanged.
The sampled path painted the blurred or sharpened color as in Normal mode. The Mode now compares the result with the image as shown, since the layer painted onto is often empty.
…red at once With Sample All Layers the tool read the layers below before the stroke began; a release (or moves) arriving during that read were lost, so the dab stayed unstored until the next stroke or tool change. The read now happens while the stroke queues its samples, and the brush is cleaned and reloaded only after the stroke has ended.
Like the other brushes, Escape during the drag now discards the stroke instead of healing or removing it on release.
…ated or multi-page image A GIF or APNG opened as its first frame, a multi-page TIFF opened as its first page, an animated WebP (which only ever opened as its first frame) and a TIFF whose other editor's layers were ignored all saved back to their own file without a question, replacing the whole file with the one image that was opened. Save now names what of the file was not opened and offers a .photo project instead, as it does for other losses.
… or CMYK colors Saving a document back over the Puter image it came from replaced a camera JPEG's EXIF data (capture time, camera, location) and XMP metadata, which Photo Studio does not read or write, without a word, and wrote a CMYK TIFF or JPEG back as RGB. Save now names these with the other losses, once per document, and says a .photo project leaves the file as it is. Questions about what of the file was not opened are now asked only when Save writes over that Puter file: a file opened from this device saves to a new one, so there is nothing to ask.
…ther task started meanwhile The editor is released while a Puter picker is open, and what follows the picker ran through Editor.run, which does nothing while another task runs. A command started while the picker was open made Open from Puter and Import Layers from Puter ignore the chosen files, and Export Layers, the Image Processor and page export write nothing to the chosen folder, all without a word. They now wait for that task to finish. Saving to a Puter folder also names the file that could not be written and how many were, and the Image Processor's closing message there names the images that failed, as its download does.
…latten the file itself unasked Save a Copy as the image format a document came from remembered the losses agreed to for that copy, so the next Save wrote the flattened image over the document's own file without asking. As with a PSD copy, the answer now holds only for the copy.
… stops the others The recovery pass stopped at the first document whose copy could not be written (a project over the 512 MB or metadata limit, browser storage full), so no later tab got a recovery copy, and the failure only reached the console. Each document is now written on its own, and a failure is reported once per document and cause, saying to save it. Autosaved versions likewise go on past a document that cannot be stored.
…four times Reading one PNG chunk (the color profile, the resolution, the bit depth, whether it is animated) computed the CRC of every chunk in the file, so opening an 8-bit PNG checksummed all its image data four times before the browser decoded it. The checksum is now computed only when asked for. On a 61 MB PNG the metadata reads at open went from about 450 ms to under 2 ms (Node, M-series).
…e files it processes Projects and PSDs processed by the Image Processor (and images run through document steps) open in temporary tabs, and each was noted as a recent file: a batch pushed the user's own files off Open Recent and, past eight local files, deleted the copies that let them reopen after a reload. Those tabs are no longer noted.
…ts file held A document restored after a crash saved back over its Puter image without the question about the frames, pages or metadata of that file that were never opened. The recovery copy now carries them.
…on, as an 8-bit one does The browser applies a PNG's eXIf orientation to the 8-bit PNGs it decodes, but 16-bit PNGs are decoded by Photo Studio, which ignored it: the same photo opened sideways at 16 bits and upright at 8. The orientation is now applied to 16-bit samples too.
…ion skin, timeline, artboard, frame and Divide Slice settings without asking again These dialogs used a plain form dialog, so recording stored the bare command: playback opened the dialog for every step (and every file in a batch), and cancelling it did not stop the action. They now use the settings dialog that records confirmed settings and applies them on playback.
…o decoders, decoded sound and frame thumbnails Nothing dropped them on close: decoders (holding the whole footage file) stayed open until six newer ones replaced them, decoded audio stayed in its 1 GB cache, and frames and thumbnails kept counting against their budgets. A close hook now drops what only the closed document used, and decodes still running for it are not cached.
…n commands that are never recorded, such as Delete Custom Brushes Recording and Insert Menu Item never add these commands, but playback ran any command a file or link named, so a shared action could delete the opener's custom brushes or reset presets without asking.
…nother tab is chosen while it runs Each step edited whichever document was active, so choosing another tab mid-run applied the remaining steps (and their undo step) to that one. Steps now return to the plan's document first, and stop if it was closed.
…er changing a setting The preview refresh that a setting change schedules started encoding the same pane while Export was encoding it, which made Export give up with missing images: nothing was saved and the error was overwritten at once. Previews now wait while Export encodes.
…cument and holds the editor until it finishes Event actions played on whichever document was active without holding the editor, so choosing another tab while one played sent its remaining steps to that document. They now play on the event's document while it is open, and a tab chosen meanwhile is shown when the action ends, as for scripts.
… it saves to a Puter folder The Puter folder save ended with its own message, which replaced the note about images that could not be corrected; the note is now passed along, as the Image Processor does.
… no longer keeps a full-size copy of the image in memory The preview finished after the dialog closed and created an image URL that nothing revoked (13 MB for a 2400 × 1600 photo, on every early cancel).
…its own size instead of stretching it out of line A stored state whose proportions were within 1% of the current canvas was treated as an image resize and stretched over it, so a crop of a few dozen pixels misaligned the comparison by up to the cropped amount (and tiny resizes rounded to whole pixels were not recognized). Now a resize is a change where either side's scale predicts the other side within a pixel.
…no longer reports faces found for the closed window
The late answer was added to the closed workspace and its status message
("Found 1 face. Check each guide…") appeared after Cancel; errors from the
abandoned search were shown too. Both are now dropped once the window is gone.
…blend was generating When blends arrived, the newest was selected automatically and, since a blend restores the arrangement it was made for, any move, scale or flip made while waiting was silently undone. Now a blend made for an older arrangement waits to be picked, and the status says that picking it goes back to that arrangement.
…election and Direct Selection tools nudge the selected path again The relight handles took every arrow key while a relight layer was the selected layer, so a selected work path, saved path or vector mask could not be nudged from the keyboard and the light moved instead. The path selection tools now keep their arrow keys.
…es slider is moved and put back A slider dragged away and back to its value previews without a final change event, so the previewed settings stayed behind and the canvas handles kept drawing them: arrow-key nudges and undo moved the light in the image but not its handle. The preview now only counts while the document is still the one it started from.
…screen instead of canvas size fields that ignored what was typed
…e are disabled and Window › Documents no longer lists the start screen as Untitled
…ocus when the tabs redraw after a zoom or an edit The tab bars were rebuilt on every update, which dropped the focus to the page. They now redraw only when their markup changes and put the focus back on the same tab.
… Linux instead of the Mac key
…, tool keys and shortcuts such as Select All work again A focused checkbox or radio button counted as typing, so every bare key and Mod+A/C/V/X was ignored until the canvas was clicked. Such controls now keep only the keys they use (Space, Enter, Tab and the arrows).
…ons as icons instead of running off the canvas under the panels
…d of the hidden canvas, a phantom Untitled tab and the dimmed tool options With no document open, the document tabs, the canvas area and the tool options (which the start screen covers or dims) are inert, so neither the keyboard nor screen readers reach them.
…e image's left edge (now on the right) instead of labelling the mirrored image as if unflipped
…of leaving its thumbnail and an enabled zoom slider on the start screen
…lder Untitled document and its New Snapshot button is disabled
…on tooltips name the keys set in the Keyboard Shortcuts editor instead of the default ones
…cus ring outside the button, where it stays visible, instead of blending into the blue fill
… and closing a PNG is covered through the question about what it leaves out Since Save writes an opened PNG back as a PNG, the two specs that close a document with Save stopped at the "Save as PNG" question about the guide they add, so the document never closed. The product behaves as intended; the specs now name their documents as projects, as the transform and close specs already do, and a new spec closes a PNG through that question.
… the stroke is pressed, also on touch The unaligned pattern was anchored at the last hovered position, which a touch never sets (the pattern then sat at the document origin, as if Aligned were on) and which can trail the press point after a mouse moved elsewhere. It now uses the point the stroke started at.
…ws its line from where the stroke ended With smoothing, releasing the button catches the stroke up to the pointer, but Shift-click continued from the smoothed point before that catch-up, so the straight line started inside the previous stroke. It now starts at the point the stroke actually ended.
…and Slice Options with their settings without asking again These dialogs used the free-form modal, so recording stored the bare command: playback (and every file in a batch) opened the dialog again, and cancelling it did not stop the action. A settings modal now records the confirmed values of the dialog's controls; playback applies them (checked against the controls) without a dialog, and a step with its dialog on opens it showing them.
… keeps the dropped photos Run went through the editor's busy guard, which skips a task while another one runs, and then cleared the list: nothing ran and the photos were gone. Run now waits for the other task (the status says so), runs the photos that were listed, and keeps photos dropped during a run for the next one.
…as it renders instead of holding every frame image at once Every frame's full composite was kept until all frames had rendered, then converted to tiles, so memory peaked at the images plus their tiles. Each frame now becomes tiles right away (held against tile cleanup until the layers join the document). 100 frames at 1920x1080: peak array-buffer memory 1.82 GB before, about 1.06 GB after (the new layers' tiles).
…keep each result once and build the ZIP without copying the results Each output was kept as bytes and as a Blob, and the ZIP copied the bytes into one buffer that was copied again into a Blob for the download. Results are now kept as Blobs with their checksums, and the ZIP is a Blob made of the headers and those Blobs. 16 outputs of 286 MB in all: peak memory of the browser's processes rose 1342 MB before and about 470 MB after (renderer array buffers 620 MB before, 112 MB after).
…lect and Mask show shortcuts as this platform types them (⌘Z, Ctrl+Z) instead of "Mod+Z"
…and the batch link's Open Link keep 4.5:1 contrast in every theme and highlight color They used the raw accent color (3.0:1 on the hovered step's gray box in the dark theme). They now use the --link token, and the step name no longer takes the button hover background, like other link buttons.
… a slot's tools no longer nudge the layer when the Move tool is active The toolbar handled the keys but let them reach the workspace, which nudged the selected layer by a pixel for each press.
… right arrow key or Alt+Enter, and no longer tells screen readers it opens a menu when Enter changes the mode Like a tool slot's flyout, the list of a tools-panel button (screen modes, Quick Mask) opens from the keyboard; its tooltip says so.
… no light handles on the canvas, so its lights can no longer be dragged or nudged unseen
… its own settings instead of the built-in Defaults or Last Used
…urns comparing off again when released, also when the comparison view takes longer than the hold to load The release only ended a comparison that was already showing; one that started after the view finished loading stayed on.
…Stop or a failed run leaves the button saying Generate until a run has delivered results, and picking a new object resets it
…ns or Rotate Object open redraws the preview from its small copy and rebuilds it from the full image once resizing pauses Every resize event copied and redrew the whole image (96 MB at 6000 x 4000). With a 6000 x 4000 image, a resize event and its frame took 134-138 ms (median) in Recompose and Rotate Object, now 78-82 ms; the final preview is unchanged.
…s a project Since Save writes an opened PNG back as a PNG, this spec's layered document stopped at the "Save as PNG" question about the layers a PNG flattens, so it waited for the editor until it timed out, on main as well. The product behaves as intended; the spec now names its document as a project, as the other transform and close specs were changed to do with that commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An adversarial review of Photo Studio: 75 verified fixes, one commit each, plus one spec brought up to date. Every bug was reproduced before it was fixed (a failing test, a reproduction script, or a code trace with concrete inputs). Almost every fix adds a regression test that fails without it.
Data loss and corruption
.photoproject instead.Wrong output
Layers, undo and locks
Ungroup, Align, Reverse, Delete All Empty Layers, the Properties background fill and new layers in locked groups now respect locks. Opacity and blend-mode keys on another layer no longer merge into the previous layer's undo step. Undoing a script run also undoes its first edit.
Memory and performance
Workflows
Recorded actions replay Tween, frame delay, onion skin, artboard, slice, Transitions, Interpret Footage and Slice Options with their settings instead of reopening the dialog. Export for Web exports right after a setting change. Batch link Run waits for a running task instead of dropping your photos. Fixes to round-6 features: AI Recompose, Remove Reflections, Liquify's Find with AI, relight handles and the Generate button.
Accessibility and UI
--linktoken. Focus rings on primary buttons are visible.Behavior changes to be aware of
Verification
tsc --noEmitis clean.TZ=UTC: 2,809 passed, 27 skipped, all skips pre-existing. No.skip/.onlyor timing assertions were added.main(stale close-with-Save specs); fixed in this PR.mainbaseline for comparison: 1,369 passed, 6 failed (stale specs, fixed in this PR).Performance (main vs this branch)
Real-GPU headless Chrome (ANGLE Metal),
scripts/perf-large-image.mjson a 24 MP document. Main and branch were run alternately; 5 repetitions per round, medians shown per round.Known issues, not fixed